package com.basker.pisces.orm.session;

import com.basker.pisces.spring.SpringApplicationContext;

public class SqlSessionFactoryManager {
    private static ISqlSessionFactory DEFAULT_FACTORY = null;

    public static ISqlSessionFactory getDfaultFactory() {
        if (DEFAULT_FACTORY == null) {
            setDfaultFactory();
        }

        return DEFAULT_FACTORY;
    }

    public static synchronized void setDfaultFactory() {
        if (DEFAULT_FACTORY == null) {
            DEFAULT_FACTORY = SpringApplicationContext.getInstance().getBean(DefaultSqlSessionFactory.class);
        }
    }

}
